home *** CD-ROM | disk | FTP | other *** search
- /* This file contains empty template routines that
- * the IDCMP handler will call uppon. Fill out these
- * routines with your code or use them as a reference
- * to create your program.
- */
-
- #include <exec/types.h>
- #include <exec/lists.h>
- #include <exec/memory.h>
- #include <exec/nodes.h>
- #include <exec/execbase.h>
- #include <intuition/intuition.h>
- #include <intuition/classes.h>
- #include <intuition/classusr.h>
- #include <intuition/imageclass.h>
- #include <intuition/gadgetclass.h>
- #include <libraries/gadtools.h>
- #include <libraries/asl.h>
- #include <libraries/locale.h>
- #include <libraries/amigaguide.h>
- #include <graphics/displayinfo.h>
- #include <graphics/gfxbase.h>
- #include <dos/datetime.h>
- #include <dos/dostags.h>
- #include <dos/exall.h>
-
- #include <clib/alib_protos.h>
- #include <clib/exec_protos.h>
- #include <clib/dos_protos.h>
- #include <clib/iffparse_protos.h>
- #include <clib/asl_protos.h>
- #include <clib/intuition_protos.h>
- #include <clib/icon_protos.h>
- #include <clib/amigaguide_protos.h>
- #include <clib/wb_protos.h>
- #include <clib/gadtools_protos.h>
- #include <clib/graphics_protos.h>
- #include <clib/utility_protos.h>
- #include <clib/locale_protos.h>
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
-
- #define CATCOMP_NUMBERS
-
- #include "project.catalog.h"
-
- #include "compiler.h"
-
- #include "project.h"
-
- /* Variables pour AmigaGuide */
-
- struct Library *AmigaGuideBase;
-
- char *Context[] = {
- "Main",
- NULL
- };
- struct NewAmigaGuide aghelp = { NULL,"project.guide", Scr,NULL,NULL,NULL,"Project Handler",HTF_LOAD_INDEX, Context,NULL,NULL,NULL,NULL, };
- struct NewAmigaGuide agdocs = { NULL,NULL, Scr,NULL,NULL,NULL,"Project Handler",HTF_LOAD_INDEX, Context,NULL,NULL,NULL,NULL, };
- AMIGAGUIDECONTEXT handlehelp,handledocs;
-
- /* Variables externes pour la localisation */
-
- struct Library *LocaleBase=NULL;
- struct Catalog *Catalog;
-
- extern struct NewGadget ParmsLineNGad[];
- extern UBYTE *MessWdt;
- extern UBYTE *ParmsLineWdt;
- extern UBYTE *CompileWdt;
- extern UBYTE *CompilerWdt;
- extern UBYTE *LinkerWdt;
- extern UBYTE *ScreenPrefsWdt;
- extern UBYTE *PalettePrefsWdt;
- extern struct NewGadget CompilerNGad[],LinkerNGad[],ScreenPrefsNGad[],PalettePrefsNGad[];
-
- extern struct NewScreen ns;
-
- extern UBYTE *Type0Labels[];
- extern struct Node Pens1Nodes[];
-
- /* Variables global de status */
-
- BOOL named = FALSE;
- BOOL saved = TRUE;
-
- UWORD ROMVersion;
-
- extern char *ParmsLine;
- extern void ProjectCloseCompilerOpt( BOOL );
- extern void ProjectCloseLinkerOpt( BOOL );
- extern void CloseScreenPrefs( BOOL );
- extern void ProjectCloseDirSet( BOOL );
- extern void ProjectCloseGenOpt( BOOL );
- extern struct TagItem *BuildScreenTags( void );
- extern void BuildDefScreen( struct TagItem * );
- extern void DeleteScreenTags( void );
-
- struct List *ModuleList;
- struct Resource *ProjectScreen;
-
- struct TagItem *ScreenTags;
-
- struct ModuleNode *CurrentModule;
-
- /* Variables du menu options */
-
- /****************************************************************************
- *** ***
- *** Gestion de la liste des modules ***
- *** ***
- ****************************************************************************/
-
- /****************************************************************
- *** Liste des modules au niveau de GadTools ***
- ****************************************************************/
-
- void DettachList( void ) {
- GT_SetGadgetAttrs( ProjectGadgets[0] , ProjectWnd , NULL , GTLV_Labels , NULL , TAG_DONE );
- }
-
- void AttachList( void ) {
- GT_SetGadgetAttrs( ProjectGadgets[0] , ProjectWnd , NULL , GTLV_Labels , (long)ModuleList , TAG_DONE );
- }
-
- /****************************************************************
- *** Creation du nom devant être affiché dans la liste ***
- ****************************************************************/
-
- void MakeRealNameList( struct ModuleNode *mn ) {
- char *name,*objfile;
- struct FileInfoBlock fib;
- char size[10];
-
- if ( stricmp( mn->directory , SourceDir ) )
- name = mn->pathfile;
- else
- name = mn->filename;
- mn->namelist = malloc( strlen(name) + 20 );
- *mn->namelist = 0;
- if ( mn->type=='c' && GetInfo( &fib , mn->pathfile ) ) {
- ltoa( size , fib.fib_Size );
- while( strlen( mn->namelist ) + strlen( size ) < 6 )
- strcat( mn->namelist , " " );
- strcat( mn->namelist , size );
- } else
- strcat( mn->namelist , " -- " );
- if ( mn->type == 'c' ) {
- objfile = MakeObjectPath( mn->filename );
- } else
- objfile = strdup( mn->pathfile );
- if ( GetInfo( &fib , objfile ) ) {
- ltoa( size , fib.fib_Size );
- while( strlen( mn->namelist ) + strlen( size ) < 13 )
- strcat( mn->namelist , " " );
- strcat( mn->namelist , size );
- } else
- strcat( mn->namelist , " -- " );
- free( objfile );
- if ( IsCommented( mn->pathfile ) )
- strcat( mn->namelist , " * " );
- else
- strcat( mn->namelist , " " );
- strcat( mn->namelist , name );
- mn->node.ln_Name = mn->namelist;
- mn->name = &mn->namelist[17];
- }
-
- /****************************************************************
- *** Mise à jour des noms apparaissant dans la liste ***
- ****************************************************************/
-
- long SelectModule;
-
- void UpDateSelectedModule( void ) {
- GT_SetGadgetAttrs( ProjectGadgets[0] , ProjectWnd , NULL , GTLV_Selected , SelectModule , TAG_DONE );
- GT_SetGadgetAttrs( ProjectGadgets[0] , ProjectWnd , NULL , GTLV_Top , SelectModule , TAG_DONE );
- }
-
- void UpdateNameList( void ) {
- struct ModuleNode *mn=ModuleList->lh_Head;
-
- DettachList( );
- while( mn->node.ln_Succ ) {
- MakeRealNameList( mn );
- mn = mn->node.ln_Succ;
- }
- AttachList( );
- UpDateSelectedModule( );
- }
-
- /****************************************************************
- *** Liste des modules dans le chainage d'Exec ***
- ****************************************************************/
-
- BOOL FindName2( struct List *liste , char *search ) {
- struct ModuleNode *wn=liste->lh_Head;
-
- while( wn->node.ln_Succ ) {
- if ( !stricmp( wn->name , search ) )
- return( TRUE );
- wn = wn->node.ln_Succ;
- }
- return( FALSE );
- }
-
- struct ModuleNode *AddModuleNode( struct List *list , char *name , char *directory ) {
- struct ModuleNode *wn;
- struct ModuleNode *bn = list->lh_TailPred;
- int r;
- char *t;
-
- if ( (wn = malloc( sizeof(struct ModuleNode) )) ) {
- if ( !strchr( directory , ':' ) )
- wn->directory = PathName( SourceDir , directory );
- else
- wn->directory = strdup( directory );
- wn->pathfile = PathName( wn->directory , name );
- wn->filename = BaseName( wn->pathfile );
-
- r = stricmp( wn->directory , SourceDir );
- if ( (r && FindName2( list , wn->pathfile )) ||
- (!r && FindName2( list , wn->filename )) ) {
- free( wn->directory );
- free( wn->pathfile );
- free( wn );
- return( NULL );
- }
-
- wn->node.ln_Type = MODULE_NODE;
- if ( t = strchr( wn->filename , '.' ) )
- wn->type = tolower( t[1] );
- else
- wn->type = 0;
-
- if ( list == ModuleList ) {
- saved = FALSE;
- MakeRealNameList( wn );
- } else {
- wn->node.ln_Name = wn->namelist = strdup( name );
- wn->name = wn->pathfile;
- }
- if ( wn->type != 'l' )
- while( (struct List *)bn!=list && bn->type != wn->type && bn->type != 'c' )
- bn = bn->node.ln_Pred;
- while( (struct List *)bn!=list && stricmp( wn->name , bn->name ) < 0 && wn->type == bn->type )
- bn = bn->node.ln_Pred;
- if ( (struct List *)bn!=list )
- Insert( list , (struct Node *)wn , (struct Node *)bn );
- else
- AddHead( list , (struct Node *)wn );
- return( wn );
- }
- return( NULL );
- }
-
- /****************************************************************
- *** Detruit un module dans une liste ***
- ****************************************************************/
-
- void RemModuleNode( struct ModuleNode *wn ) {
-
- free( wn->directory );
- free( wn->pathfile );
- free( wn->namelist );
- Remove( (struct Node *)wn );
- free( wn );
- }
-
- /****************************************************************
- *** Detruit tous les modules d'une list ***
- ****************************************************************/
-
- void FreeModuleNodes( struct List *list ) {
- struct ModuleNode *wn,*nn;
-
- wn = list->lh_Head;
- while( wn->node.ln_Succ ) {
- nn = wn->node.ln_Succ;
- RemModuleNode( wn );
- wn = nn;
- }
- }
-
- /****************************************************************
- *** Detruit une liste ainsi que ses modules ***
- ****************************************************************/
-
- void FreeList( struct List *list ) {
- FreeModuleNodes( list );
- free( list );
- }
-
- /****************************************************************
- *** Genere une liste des fichiers include ***
- ****************************************************************/
-
- void AddIncludeList( struct List *list , struct ModuleNode *wn ) {
- FILE *in;
- char temp[200];
- long ct=0;
-
- if ( wn ) {
- if ( in = fopen( wn->pathfile , "r" ) ) {
- while( !feof( in ) && ct < 20 ) {
- fgets( temp , 200 , in );
- if ( !strnicmp( temp , "#include \"" , 10 ) ) {
- temp[ strlen(temp) - 2 ] = 0;
- AddModuleNode( list , &temp[10] , wn->directory );
- ct = 0;
- }
- if ( !strnicmp( temp , "#include <" , 10 ) ) {
- temp[ strlen(temp) - 2 ] = 0;
- AddModuleNode( list , &temp[10] , "DINCLUDE:" );
- ct = 0;
- }
- ct++;
- }
- fclose( in );
- }
- }
- }
-
- struct List *BuildIncludeList( struct ModuleNode *wn ) {
- struct List *build;
-
- if ( build = malloc( sizeof( struct List ) ) ) {
- NewList( build );
- AddIncludeList( build , wn );
- return( build );
- }
- return( NULL );
- }
-
- /****************************************************************************
- *** ***
- *** Initialisation / Liberation des variables globales ***
- *** ***
- ****************************************************************************/
-
- int InitVar( void ) {
- AmigaGuideBase = OpenLibrary( "amigaguide.library" , 0L );
- if ( !AmigaGuideBase )
- {
- ProjectNewMenu[9].nm_Flags = NM_ITEMDISABLED;
- ProjectNewMenu[23].nm_Flags = NM_ITEMDISABLED;
- DirSetGTags[37] = TRUE;
- DirSetGTags[42] = TRUE;
- }
- ModuleList = malloc( sizeof( struct List ) );
- if ( !ModuleList )
- return( FALSE );
- BuildDefScreen( NULL );
- BuildScreenTags( );
- CloseScreenPrefs( FALSE );
- NewList( ModuleList );
-
- SourceDir = getcwd( NULL , 500 );
- DestDir = strdup( SourceDir );
- IncludeDir = PathName( SourceDir , "include" );
- LibDir = PathName( SourceDir ,"dlib" );
- ObjDir = strdup( SourceDir );
- PrgDir = PathName( SourceDir , "bin/" );
- DICEDir = strdup( SourceDir );
- AutoDir = strdup( SourceDir );
- MakeAssign( );
- ProjectPathName = strdup( SourceDir );
- ProjectName = strdup( "No Name" );
- WindowTitle = strdup( "Project Handler : No Name" );
- StartDir = getcwd( NULL , 500 );
- OptLine = strdup( "" );
- ParmsLine = strdup( "" );
- MakeOptions( );
- CurrentModule = NULL;
- LoadPrefs( );
- return( TRUE );
- }
-
- void FreeVar( void ) {
- FreeList( ModuleList );
- DeleteScreenTags( );
- RemoveAssign( );
- free( DICEDir );
- free( SourceDir );
- free( DestDir );
- free( IncludeDir );
- free( LibDir );
- free( ObjDir );
- free( PrgDir );
- free( ProjectPathName );
- free( ProjectName );
- free( WindowTitle );
- free( StartDir );
- free( OptLine );
- free( ParmsLine );
- CloseLibrary( AmigaGuideBase );
- }
-
-
- /****************************************************************************
- *** ***
- *** Action des boutons ( liste ) de la fenêtre principale ***
- *** ***
- ****************************************************************************/
-
- int ModuleListClicked( void )
- {
- int n = ProjectMsg.Code;
- struct ModuleNode *wn = ModuleList->lh_Head;
- static ULONG sec=-1,mic;
-
- SelectModule = n;
- while( wn->node.ln_Succ && n-- ) {
- wn = wn->node.ln_Succ;
- }
- if ( wn->node.ln_Succ )
- CurrentModule = wn;
-
- if ( sec != -1 && DoubleClick( sec , mic , ProjectMsg.Seconds , ProjectMsg.Micros ) )
- ProjectEdit( );
- sec = ProjectMsg.Seconds;
- mic = ProjectMsg.Micros;
- }
-
-
- /****************************************************************************
- *** ***
- *** Actions de gestion multitache (fermeture) ***
- *** ***
- ****************************************************************************/
-
- void CloseLaunchOpt( BOOL use ) {
- if ( ParmsLineWnd ) {
- if ( use == TRUE ) {
- ReplaceChar( &ParmsLine , GetString( ParmsLineGadgets[2] ) );
- }
- RemWinC( ParmsLineWnd );
- CloseParmsLineWindow( );
- }
- }
-
- int CloseEverything( void ) {
- if ( handledocs )
- {
- SendAmigaGuideCmdA( handledocs , "QUIT" , NULL );
- Delay( 10 );
- CloseAmigaGuide( handledocs );
- handledocs = FALSE;
- }
- if ( handlehelp ) {
- SendAmigaGuideCmdA( handlehelp , "QUIT" ,NULL );
- Delay( 10 );
- CloseAmigaGuide( handlehelp );
- handlehelp = FALSE;
- }
- ProjectCloseGenOpt( FALSE );
- CloseLaunchOpt( FALSE );
- CloseScreenPrefs( FALSE );
- ProjectCloseCompilerOpt( FALSE );
- ProjectCloseLinkerOpt( FALSE );
- ProjectCloseDirSet( FALSE );
- MessCloseWindow( );
- RemWinC( ProjectWnd );
- CloseProjectWindow( );
- }
-
- /****************************************************************************
- *** ***
- *** Actions des menus de la fenêtre principale ***
- *** ***
- ****************************************************************************/
-
- int CancelForSave( void ) {
- int r=1;
-
- if ( !strcmp( ProjectName , "No Name" ) )
- return( 0 );
- while ( !saved && r==1 ) {
- r = 2-Message( StrMessages[MSG_MESSAGE_SAVE] , StrMessages[MSG_MESSAGE_SAVE_ANS] );
- if ( r==2 )
- return( 1 );
- if ( r==1 )
- ProjectSave();
- }
- return( 0 );
- }
-
- int ProjectNew( void )
- {
- if ( !CancelForSave() ) {
- DettachList( );
- FreeModuleNodes( ModuleList );
- ChangeProjectName( "No Name" );
- saved = TRUE;
- }
- }
-
- int ProjectOpen( void )
- {
- struct FileRequester *fr;
- char *pf,name[200];
- struct IFFHandle *iff;
- struct Resource *OldScr = ProjectScreen;
- struct StoredProperty *buf;
- char *data,*fdata;
- long w1t,w1l,w2w,w2h,w2t,w2l,w1w,w1h;
-
- if ( !CancelForSave() )
- if ( fr = AskFile( ProjectPathName , StrMessages[MSG_MESSAGE_ASK_OPEN] , "#?.prj" ) ) {
- pf = PathName( fr->rf_Dir , fr->rf_File );
- if ( iff = OpenIffFile( pf , MODE_OLDFILE ) ) {
- PropChunk( iff , ID_PROJ , ID_MODS );
- StopOnExit( iff , ID_PROJ , ID_FORM );
- if ( LoadOptions( iff ) ) {
- ParseIFF( iff , IFFPARSE_SCAN );
- if ( buf = FindProp( iff , ID_PROJ , ID_MODS ) ) {
- FreeModuleNodes( ModuleList );
- data = (char *)buf->sp_Data;
- fdata = (char *)buf->sp_Data + buf->sp_Size;
- while( data < fdata ) {
- AddModuleNode( ModuleList , data , data + strlen(data)+1 );
- data += strlen( data ) + 1;
- data += strlen( data ) + 1;
- }
- DettachList( );
- w1t = ProjectTop;
- w1l = ProjectLeft;
- w1w = ProjectWidth;
- w1h = ProjectHeight;
- w2t = MessTop;
- w2l = MessLeft;
- w2w = MessWidth;
- w2h = MessHeight;
- CloseEverything( );
- ProjectTop = w1t;
- ProjectLeft = w1l;
- ProjectWidth = w1w;
- ProjectHeight = w1h;
- MessTop = w2t;
- MessLeft = w2l;
- MessWidth = w2w;
- MessHeight = w2h;
- CloseDownScreen( );
- SelectModule = 0;
- CurrentModule = NULL;
- named = TRUE;
- saved = TRUE;
- SetupScreen( );
- OpenProjectWindow( );
- AttachList( );
- AddWinC( ProjectWnd , HandleProjectIDCMP );
- ChangeProjectName( pf );
- } else
- Message( StrMessages[MSG_MESSAGE_NLOAD] , StrMessages[MSG_MESSAGE_CONTINUE] );
- }
- CloseIffFile( iff );
- } else {
- strcpy( name , StrMessages[MSG_MESSAGE_CANT] );
- strcat( name , BaseName( pf ) );
- Message( name , StrMessages[MSG_MESSAGE_OK] );
- }
- free( pf );
- FreeAslRequest( fr );
- }
- }
-
- void SaveProject( void ) {
- struct IFFHandle *iff;
- struct ModuleNode *wn = (struct Node *)ModuleList->lh_Head;
-
- if ( iff=OpenIffFile( ProjectPathName , MODE_NEWFILE ) ) {
- PushChunk( iff , ID_PROJ , ID_FORM , IFFSIZE_UNKNOWN );
- SaveOptions( iff );
- PushChunk( iff , ID_PROJ , ID_MODS , IFFSIZE_UNKNOWN );
- while( wn->node.ln_Succ ) {
- WriteChunkBytes( iff , wn->filename , strlen(wn->filename)+1 );
- WriteChunkBytes( iff , wn->directory , strlen(wn->directory)+1 );
- wn = wn->node.ln_Succ;
- }
- PopChunk( iff );
- PopChunk( iff );
- CloseIffFile( iff );
- saved = TRUE;
- }
- }
-
- int ProjectSaveas( void )
- {
- struct FileRequester *fr;
- char *pf1,*pf;
-
- if ( fr = AskFile( ProjectPathName , StrMessages[MSG_MESSAGE_ASK_SAVE] , "#?.prj" ) ) {
- pf1 = PathName( fr->rf_Dir , fr->rf_File );
- pf = malloc( strlen( pf1 ) + 5 );
- strcpy( pf , pf1 );
- if ( stricmp( ".prj" , &pf1[ strlen( pf1 ) - 4 ] ) )
- strcat( pf , ".prj" );
- if ( Overwrite( "project" , pf ) ) {
- ChangeProjectName( pf );
- SaveProject( );
- named = TRUE;
- } else
- free( pf );
- FreeAslRequest( fr );
- }
- }
-
- int ProjectSave( void )
- {
- if ( !named ) {
- ProjectSaveas( );
- }
- SaveProject( );
- }
-
- /* Iconification : Ne marche pas pour l'instant ????? */
-
-
- int ProjectIcon( void )
- {
- struct AppMessage *appmsg=NULL;
- static struct MsgPort *iconport=NULL;
- static struct AppIcon *appicon=NULL;
- static struct DiskObject *dobj=NULL;
-
- if ( dobj = GetDiskObject( "Work:DICE/Project030" ) ) {
- dobj->do_Type = NULL;
- dobj->do_CurrentX = NO_ICON_POSITION;
- dobj->do_CurrentY = NO_ICON_POSITION;
- if ( iconport = CreateMsgPort() ) {
- MessCloseWindow( );
- CloseProjectWindow( );
- CloseDownScreen( );
- if ( appicon = AddAppIconA( 0 , 0L , "Project_Handler" , iconport , NULL , dobj , NULL ) ) {
- WaitPort( iconport );
- RemoveAppIcon( appicon );
- }
- DisplayBeep( NULL );
- while( appmsg=(struct AppMessage *)GetMsg( iconport ) )
- ReplyMsg( (struct Message *)appmsg );
- DeleteMsgPort( iconport );
- SetupScreen( );
- OpenProjectWindow( );
- ChangeProjectName( ProjectPathName );
- AttachList( );
- UpDateSelectedModule( );
- }
- FreeDiskObject( dobj );
- }
- }
-
- int ProjectAbout( void )
- {
- Message( "Project Handler 1.2 ( April 2, 1993 )\n\n"
- "© Copyright 1993 Arcad Development\n"
- " Written using DICE C v2.07.54R by\n"
- " Cedric Counotte\n\n"
- " Thanks to Jan van den Baard\n"
- " for GadToolsBox 37.176\n"
- , "Continue" );
- }
-
- void ChargeAide( char *node )
- {
- char *t;
-
- t = malloc( strlen(node)+8 );
- strcpy( t , "LINK " );
- strcat( t , node );
- if ( AmigaGuideBase )
- {
- if ( !handlehelp )
- {
- aghelp.nag_Screen = Scr;
- handlehelp = OpenAmigaGuideAsyncA( &aghelp , NULL );
- Delay( 10 );
- SetAmigaGuideAttrs( handlehelp , AGA_Activate , TRUE , TAG_DONE );
- }
- if ( handlehelp )
- SendAmigaGuideCmdA( handlehelp , t ,NULL );
- }
- else
- Message( StrMessages[MSG_MESSAGE_NOGUIDE] , StrMessages[MSG_MESSAGE_ABORT] );
- free( t );
- }
-
- int ProjectHelp( void )
- {
- ChargeAide( "Main" );
- }
-
- int ProjectQuit( void )
- {
- if ( !CancelForSave() ) {
- CloseEverything( );
- }
- }
-
- int ProjectEdit( void )
- {
- if ( CurrentModule ) {
- EditModule( CurrentModule->pathfile );
- }
- }
-
- int ProjectInclude( void )
- {
- struct List *IncludeList;
- struct ModuleNode *include;
-
- if ( CurrentModule ) {
- if ( IncludeList = BuildIncludeList( CurrentModule ) ) {
- if ( IncludeList->lh_Head->ln_Succ ) {
- include = (struct ModuleNode *)ChooseInList( StrMessages[MSG_WIN_INCLUDE_TITLE] , IncludeList , 300 , 200 );
- if ( include )
- EditModule( include->pathfile );
- }
- FreeList( IncludeList );
- }
- }
- }
-
- int ProjectComment( void )
- {
- struct FileInfoBlock fib;
- char *commentfile;
-
- if ( CurrentModule ) {
- if ( CurrentModule->filename[ strlen(CurrentModule->filename)-1 ] == 'c' ) {
- commentfile = CommentName( CurrentModule->pathfile );
- if ( !GetInfo( &fib , commentfile ) )
- if ( !Message( StrMessages[MSG_MESSAGE_NOCOMMENT] , StrMessages[MSG_MESSAGE_NOCOMMENT_ANS] ) ) {
- free( commentfile );
- return( 0 );
- }
- EditModule( commentfile );
- DettachList( );
- MakeRealNameList( CurrentModule );
- AttachList( );
- UpDateSelectedModule( );
- free( commentfile );
- } else
- Message( StrMessages[MSG_MESSAGE_NOTONC] , StrMessages[MSG_MESSAGE_CONTINUE] );
- }
- }
-
- int ProjectCommentKill( void )
- {
- char *commentfile,mess[200];
-
- if ( CurrentModule ) {
- if ( CurrentModule->filename[ strlen(CurrentModule->filename)-1 ] == 'c' ) {
- commentfile = CommentName( CurrentModule->pathfile );
- if ( IsCommented( CurrentModule->pathfile ) ) {
- strcpy( mess , StrMessages[MSG_MESSAGE_BINDED1] );
- strcat( mess , CurrentModule->filename );
- strcat( mess , StrMessages[MSG_MESSAGE_BINDED2] );
- if ( Message( mess , StrMessages[MSG_MESSAGE_BINDED_ANS] ) ) {
- DeleteFile( commentfile );
- DettachList( );
- MakeRealNameList( CurrentModule );
- AttachList( );
- UpDateSelectedModule( );
- }
- } else
- Message( StrMessages[MSG_MESSAGE_DONT_OWNED] , StrMessages[MSG_MESSAGE_CONTINUE] );
- free( commentfile );
- } else
- Message( StrMessages[MSG_MESSAGE_CANT_OWNED] , StrMessages[MSG_MESSAGE_CONTINUE] );
- }
- }
-
- int ProjectAdd( void )
- {
- struct FileRequester *fr;
- struct Node *wn = ModuleList->lh_Head;
-
- if (fr = AskFile( SourceDir , StrMessages[MSG_MESSAGE_ADD_MOD] , "(#?.a|#?.c|#?.o|#?.lib)" )) {
- DettachList( );
- CurrentModule = AddModuleNode( ModuleList , fr->rf_File , fr->rf_Dir );
- SelectModule = 0;
- AttachList( );
- if ( CurrentModule ) {
- while( wn->ln_Succ && wn!=(struct Node *)CurrentModule ) {
- wn = wn->ln_Succ;
- SelectModule ++;
- }
- UpDateSelectedModule( );
- }
- FreeAslRequest(fr);
- }
- }
-
- int ProjectRem( void )
- {
- if ( CurrentModule ) {
- DettachList( );
- RemModuleNode( CurrentModule );
- saved = FALSE;
- AttachList( );
- CurrentModule = NULL;
- }
- }
-
- int ProjectOther( void )
- {
- struct FileRequester *fr;
- char *buf;
-
- if ( fr = AskFile( SourceDir, StrMessages[MSG_MESSAGE_OTHER] , "#?(.a|.c|.h)" ) ) {
- buf = PathName( fr->rf_Dir , fr->rf_File );
- EditModule( buf );
- free( buf );
- FreeAslRequest( fr );
- }
- }
-
- int ProjectAutoDocs( void )
- {
- struct Liste *Docs;
- struct ModuleNode *autodoc;
- struct ExAllControl *eac;
- BPTR lock;
- BOOL more;
- char Data[200];
- struct ExAllData *ead;
-
- if ( eac = AllocDosObject( DOS_EXALLCONTROL, NULL ) )
- {
- if ( lock = Lock( AutoDir , ACCESS_READ ) )
- {
- if ( Docs = malloc( sizeof( struct List ) ) )
- {
- NewList( Docs );
- eac->eac_LastKey = 0;
- do {
- more = ExAll( lock , (APTR)Data , 200 , ED_NAME , eac );
- ead = (struct ExAllData *)Data;
- while( ead->ed_Next )
- {
- if ( stricmp( &ead->ed_Name[strlen(ead->ed_Name)-5] , ".info" ) )
- AddModuleNode( Docs , ead->ed_Name , AutoDir );
- ead = ead->ed_Next;
- }
- } while ( more );
- autodoc = (struct ModuleNode *)ChooseInList( StrMessages[MSG_MESSAGE_AUTODOC] , Docs , 300 , 200 );
- if ( autodoc )
- {
- if ( handledocs )
- SendAmigaGuideCmdA( handledocs , "Quit" , NULL );
- agdocs.nag_Name = autodoc->pathfile;
- agdocs.nag_Screen = Scr;
- handledocs = OpenAmigaGuideAsyncA( &agdocs , NULL );
- Delay( 10 );
- SendAmigaGuideCmdA( handledocs , "ALINK Main" , NULL );
- }
- FreeList( Docs );
- }
- UnLock( lock );
- }
- FreeDosObject( DOS_EXALLCONTROL , eac );
- }
- }
-
- int CheckDependencies( struct ModuleNode *wn ) {
- char *obj;
- struct FileInfoBlock fib1,fib2;
- struct List *includes;
- BOOL ret;
-
- CompileRender( "Checking dependencies." );
- obj = MakeObjectPath( wn->filename );
- ret = !GetInfo( &fib1 , obj );
- free( obj );
-
- if ( !ret && GetInfo( &fib2 , wn->pathfile ) )
- if ( CompareDates( &fib1.fib_Date , &fib2.fib_Date ) > 0 )
- ret = TRUE;
- if ( !ret ) {
- includes = BuildIncludeList( wn );
- wn = includes->lh_Head;
- while( wn->node.ln_Succ ) {
- if ( GetInfo( &fib2 , wn->pathfile ) )
- if ( CompareDates( &fib1.fib_Date , &fib2.fib_Date ) > 0 )
- ret = TRUE;
- wn = wn->node.ln_Succ;
- }
- FreeList( includes );
- }
- CompileRender( "Compiler processing..." );
- return( ret );
- }
-
- void DeleteObjects( void ) {
- char *temp;
- struct ModuleNode *wn = ModuleList->lh_Head;
-
- while( wn->node.ln_Succ ) {
- temp = MakeObjectPath( wn->filename );
- DeleteFile( temp );
- free( temp );
- wn = wn->node.ln_Succ;
- }
- compilall = FALSE;
- }
-
- int ProjectCompile( void )
- {
- char command[500];
- struct ModuleNode *wn = ModuleList->lh_Head;
- struct IntuiMessage *m=NULL;
- BOOL ret=TRUE;
-
- SleepWinC( );
- if ( compilall )
- DeleteObjects( );
- KeepMessages = FALSE;
- OpenCompileWindow( "Compiler processing..." );
- chdir( ObjDir );
- while( wn->node.ln_Succ ) {
- if ( wn->type == 'c' ) {
- GT_SetGadgetAttrs( CompileGadgets[0] , CompileWnd , NULL , GTTX_Text , (long)wn->name , TAG_DONE );
- if ( CheckDependencies( wn ) ) {
- link = TRUE;
- strcpy( command , PrgDir );
- strcat( command , "dcc >RAM:Compiler_Error -c " );
- strcat( command , wn->pathfile );
- strcat( command , " -o \"" );
- strcat( command , wn->filename );
- command[ strlen(command)-1 ] = 'o';
- strcat( command , "\" -E \"ram:Compiler_Errors\"" );
- strcat( command , OptLine );
- DeleteFile( "RAM:Compiler_Errors" );
- DeleteFile( "RAM:Compiler_Error" );
- Launch( command , FALSE );
- if ( ViewErrors( "RAM:Compiler_Errors" ) )
- {
- ret = FALSE;
- break;
- }
- }
- if ( (m = GT_GetIMsg( CompileWnd->UserPort )) )
- {
- ret = FALSE;
- break;
- }
- }
- wn = wn->node.ln_Succ;
- }
- if ( m )
- GT_ReplyIMsg( m );
- chdir( StartDir );
- CloseCompileWindow( );
- UpdateNameList( );
- AwakeWinC( );
- return( ret );
- }
-
- void CreateObjList( void ) {
- struct ModuleNode *wn = ModuleList->lh_Head;
- FILE *out;
- char *buf;
-
- if ( out = fopen( "ram:objlist" , "w" ) ) {
- while( wn->node.ln_Succ ) {
- buf = strdup( wn->pathfile );
- if ( wn->type == 'c' ) {
- free( buf );
- buf = MakeObjectPath( wn->filename );
- }
- OutputString( buf , out );
- free( buf );
- wn = wn->node.ln_Succ;
- }
- fclose( out );
- }
- }
-
- int ProjectGenerate( void )
- {
- DeleteObjects( );
- ProjectCompile( );
- link = TRUE;
- }
-
- int ProjectLink( void )
- {
- char *command;
-
- OpenCompileWindow( "Linker processing..." );
- CreateObjList( );
- chdir( DestDir );
- command = malloc( strlen(PrgDir)+strlen(ProjectName)+strlen(OptLine)+70 );
- strcpy( command , PrgDir );
- strcat( command , "dcc >\"RAM:Linker_Error\" @RAM:objlist -E \"RAM:Linker_Errors\" -o \"" );
- strcat( command , ProjectName );
- strcat( command , "\"" );
- strcat( command , OptLine );
- DeleteFile( "RAM:Linker_Errors" );
- DeleteFile( "RAM:Linker_Error" );
- Launch( command , FALSE );
- free( command );
- chdir( StartDir );
- CloseCompileWindow( );
- if ( !ViewErrors( "RAM:Linker_Errors" ) ) {
- link = FALSE;
- return( TRUE );
- }
- return( FALSE );
- }
-
- int ProjectLibrary( void )
- {
- char *command;
-
- OpenCompileWindow( "Library Maker processing..." );
- CreateObjList( );
- chdir( DestDir );
- command = malloc( strlen(ProjectName)+50+strlen(PrgDir) );
- strcat( command , ProjectName );
- strcat( command , ".lib" );
- DeleteFile( command );
- strcpy( command , PrgDir );
- strcat( command , "libmake RAM:objlist -mRR -proto -o ram: -l \"" );
- strcat( command , ProjectName );
- strcat( command , ".lib\"" );
- Launch( command , FALSE );
- free( command );
- chdir( StartDir );
- CloseCompileWindow( );
- }
-
- int ProjectMakeFO( void )
- {
- if ( ProjectCompile( ) )
- {
- SleepWinC( );
- switch( Config.ObjType )
- {
- case 0:
- ProjectLink( );
- break;
- case 1:
- ProjectLibrary( );
- break;
- case 2:
- Message( "This kind of Final Object is not implemented!","Continue" );
- break;
- }
- AwakeWinC( );
- }
- }
-
- int ProjectCodeInfo( void )
- {
- struct FileInfoBlock fib;
- char mess[500];
- struct DateTime *dt;
-
- chdir( DestDir );
- if ( GetInfo( &fib , ProjectName ) ) {
- strcpy( mess , StrMessages[MSG_MESSAGE_PROJECTNAME] );
- strcat( mess , " : " );
- strcat( mess , ProjectName );
- strcat( mess , "\n\n" );
- strcat( mess , StrMessages[MSG_MESSAGE_EXECUTABLE] );
- strcat( mess , " : " );
- ltoa( &mess[ strlen(mess) ] , fib.fib_Size );
- strcat( mess , "\n\n" );
- strcat( mess , StrMessages[MSG_MESSAGE_DATE] );
- strcat( mess , " : " );
- if ( dt = GetDate( &fib ) ) {
- strcat( mess , dt->dat_StrDay );
- strcat( mess , " " );
- strcat( mess , dt->dat_StrDate );
- strcat( mess , "\n" );
- strcat( mess , StrMessages[MSG_MESSAGE_TIME] );
- strcat( mess , " : " );
- strcat( mess , dt->dat_StrTime );
- }
- strcat( mess , "\n\n" );
- Message( mess , StrMessages[MSG_MESSAGE_CONTINUE] );
- } else
- Message( StrMessages[MSG_MESSAGE_GENERATE] , StrMessages[MSG_MESSAGE_CONTINUE] );
- chdir( StartDir );
- }
-
- int ProjectLaunch( void )
- {
- char *command;
- char *cmd;
-
- if ( link )
- if ( !ProjectLink( ) )
- return( 0 );
- command = PathName( DestDir , ProjectName );
- cmd = malloc( strlen( command ) + strlen( ParmsLine ) + 2 );
- strcpy( cmd , command );
- strcat( cmd , " " );
- strcat( cmd , ParmsLine );
- Launch( cmd , TRUE );
- free( command );
- free( cmd );
- }
-
- void ProjectLaunchOptCommand( void ) {
- struct IntuiMessage *m;
-
- while( (ParmsLineWnd != NULL) && (m = GT_GetIMsg( ParmsLineWnd->UserPort )) ) {
- GT_ReplyIMsg( m );
- switch ( m->Class ) {
- case IDCMP_REFRESHWINDOW:
- GT_BeginRefresh( ParmsLineWnd );
- GT_EndRefresh( ParmsLineWnd, TRUE );
- break;
- case IDCMP_VANILLAKEY:
- switch( m->Code ) {
- case 13:
- case 'e':
- case 'E':
- ActivateGadget( ParmsLineGadgets[2] , ParmsLineWnd , NULL );
- break;
- case 'u':
- case 'U':
- CloseLaunchOpt( TRUE );
- break;
- case 'a':
- case 'A':
- CloseLaunchOpt( FALSE );
- break;
- }
- break;
- case IDCMP_RAWKEY:
- if ( m->Code == 95 )
- ChargeAide( "WIN_Parms" );
- break;
- case IDCMP_GADGETUP:
- switch( ((struct Gadget *)m->IAddress)->GadgetID ) {
- case 1:
- CloseLaunchOpt( TRUE );
- break;
- case 2:
- CloseLaunchOpt( FALSE );
- break;
- }
- break;
- }
- }
- }
-
- int ProjectLaunchOpt( void )
- {
- if ( !ParmsLineWnd )
- if ( !OpenParmsLineWindow() )
- {
- GT_SetGadgetAttrs( ParmsLineGadgets[2] , ParmsLineWnd , NULL , GTST_String , ParmsLine , TAG_DONE );
- AddWinC( ParmsLineWnd , ProjectLaunchOptCommand );
- }
- else {
- WindowToFront( ParmsLineWnd );
- ActivateWindow( ParmsLineWnd );
- }
- }
-
- /****************************************************************************
- *** ***
- *** Actions des messages VANILLAKEY ***
- *** ***
- ****************************************************************************/
-
- void NextModule( void ) {
- if ( !CurrentModule ) {
- CurrentModule = ModuleList->lh_Head;
- SelectModule = 0;
- } else {
- if ( CurrentModule->node.ln_Succ->ln_Succ ) {
- CurrentModule = CurrentModule->node.ln_Succ;
- SelectModule ++;
- }
- }
- UpDateSelectedModule( );
- }
-
- void PrevModule( void ) {
- if ( !CurrentModule ) {
- CurrentModule = ModuleList->lh_Head;
- SelectModule = 0;
- while( CurrentModule->node.ln_Succ->ln_Succ ) {
- CurrentModule = CurrentModule->node.ln_Succ;
- SelectModule ++;
- }
- } else {
- if ( CurrentModule->node.ln_Pred->ln_Pred ) {
- CurrentModule = CurrentModule->node.ln_Pred;
- SelectModule --;
- }
- }
- UpDateSelectedModule( );
- }
-
- void FindSelectedModule( long letter ) {
- struct ModuleNode *wn = ModuleList->lh_Head;
- BOOL found = FALSE;
- long select=0;
-
- while( wn->node.ln_Succ && !found ) {
- if ( tolower(*wn->name) == letter ) {
- found = TRUE;
- break;
- }
- select++;
- wn = wn->node.ln_Succ;
- }
- if ( found ) {
- CurrentModule = wn;
- SelectModule = select;
- UpDateSelectedModule( );
- }
- }
-
- /****************************************************************************
- *** ***
- *** Actions des messages IDCMP ***
- *** ***
- ****************************************************************************/
-
- int ProjectCloseWindow( void )
- {
- ProjectQuit( );
- }
-
- int ProjectNewSize( void )
- {
- DettachList( );
-
- RemWinC( ProjectWnd );
- CloseProjectWindow( );
- OpenProjectWindow( );
- AddWinC( ProjectWnd , HandleProjectIDCMP );
- ChangeProjectName( ProjectPathName );
- if ( named )
- saved = FALSE;
-
- AttachList( );
- UpDateSelectedModule( );
- }
-
- int ProjectCloseWB( void )
- {
- BOOL rr;
-
- while( rr && !CloseWorkBench() ) {
- rr = Message( StrMessages[MSG_MESSAGE_CANT_CLOSEWB] , StrMessages[MSG_MESSAGE_RETRY_ABORT] );
- }
- }
-
- int ProjectOpenWB( void )
- {
- OpenWorkBench();
- }
-
-
-
- /****************************************************************************
- *** ***
- *** Fonctions de localisation ***
- *** ***
- ****************************************************************************/
-
-
- void GetMenu(void)
- {
- struct NewMenu *nm = ProjectNewMenu;
- long i=MSG_MENU_PROJECT;
-
- while( nm->nm_Type )
- {
- while( nm->nm_Label == NM_BARLABEL )
- nm++;
- nm->nm_Label = GetCatalogStr( Catalog , i++ , nm->nm_Label );
- nm++;
- }
- }
-
- void GetUseCancel(void)
- {
- CompilerNGad[13].ng_GadgetText =
- LinkerNGad[0].ng_GadgetText =
- DirSetNGad[14].ng_GadgetText =
- GenOptNGad[3].ng_GadgetText =
- ScreenPrefsNGad[1].ng_GadgetText =
- PalettePrefsNGad[6].ng_GadgetText =
- ParmsLineNGad[0].ng_GadgetText =
- GetCatalogStr( Catalog , MSG_USE , "_Use" );
- CompilerNGad[14].ng_GadgetText =
- LinkerNGad[1].ng_GadgetText =
- DirSetNGad[15].ng_GadgetText =
- GenOptNGad[4].ng_GadgetText =
- ScreenPrefsNGad[2].ng_GadgetText =
- PalettePrefsNGad[7].ng_GadgetText =
- ParmsLineNGad[1].ng_GadgetText =
- GetCatalogStr( Catalog , MSG_CANCEL , "C_ancel" );
- }
-
- void MakeUseCancel(void)
- {
- CompilerNGad[13].ng_GadgetText =
- LinkerNGad[0].ng_GadgetText =
- DirSetNGad[14].ng_GadgetText =
- GenOptNGad[3].ng_GadgetText =
- ScreenPrefsNGad[1].ng_GadgetText =
- PalettePrefsNGad[6].ng_GadgetText =
- ParmsLineNGad[0].ng_GadgetText =
- "_Use";
- CompilerNGad[14].ng_GadgetText =
- LinkerNGad[1].ng_GadgetText =
- DirSetNGad[15].ng_GadgetText =
- GenOptNGad[4].ng_GadgetText =
- ScreenPrefsNGad[2].ng_GadgetText =
- PalettePrefsNGad[7].ng_GadgetText =
- ParmsLineNGad[1].ng_GadgetText =
- "C_ancel";
- }
-
- void GetTitles(void)
- {
- ProjectWdt = GetCatalogStr( Catalog , MSG_WIN_TITLE_SOURCE , ProjectWdt );
- DirSetWdt = GetCatalogStr( Catalog , MSG_WIN_TITLE_DIRSET , DirSetWdt );
- MessWdt = GetCatalogStr( Catalog , MSG_WIN_TITLE_MESS , MessWdt );
- GenOptWdt = GetCatalogStr( Catalog , MSG_WIN_TITLE_GENERAL , GenOptWdt );
- ParmsLineWdt = GetCatalogStr( Catalog , MSG_WIN_TITLE_PARMCLI , ParmsLineWdt );
- CompilerWdt = GetCatalogStr( Catalog , MSG_WIN_TITLE_COMPILER , CompilerWdt );
- LinkerWdt = GetCatalogStr( Catalog , MSG_WIN_TITLE_LINKER , LinkerWdt );
- CompileWdt = GetCatalogStr( Catalog , MSG_WIN_TITLE_PROCESS , CompileWdt );
- ScreenPrefsWdt = GetCatalogStr( Catalog , MSG_WIN_TITLE_SCREEN_PREF , ScreenPrefsWdt );
- PalettePrefsWdt = GetCatalogStr( Catalog , MSG_WIN_TITLE_PALETTE_PREF , PalettePrefsWdt );
- }
-
- void GetCompilerWnd( void )
- {
- int n = MSG_WIN_COMPILER_DIVERS_INLINE;
-
- CompilerIText[0].IText = GetCatalogStr( Catalog , MSG_WIN_COMPILER_GENERATION , CompilerIText[0].IText );
- CompilerIText[1].IText = GetCatalogStr( Catalog , MSG_WIN_COMPILER_CMODEL , CompilerIText[1].IText );
- CompilerIText[2].IText = GetCatalogStr( Catalog , MSG_WIN_COMPILER_DMODEL , CompilerIText[2].IText );
- CompilerIText[3].IText = GetCatalogStr( Catalog , MSG_WIN_COMPILER_PROCCALL , CompilerIText[3].IText );
- CompilerIText[4].IText = GetCatalogStr( Catalog , MSG_WIN_COMPILER_CTEHUNK , CompilerIText[4].IText );
- CompilerIText[5].IText = GetCatalogStr( Catalog , MSG_WIN_COMPILER_PROFILE , CompilerIText[5].IText );
- CompilerIText[6].IText = GetCatalogStr( Catalog , MSG_WIN_COMPILER_DIVERS , CompilerIText[6].IText );
-
- FPU0Labels[0] = GetCatalogStr( Catalog , MSG_WIN_COMPILER_None , FPU0Labels[0] );
- Code0Labels[0] = GetCatalogStr( Catalog , MSG_WIN_COMPILER_CSMALL , Code0Labels[0] );
- Code0Labels[1] = GetCatalogStr( Catalog , MSG_WIN_COMPILER_CLARGE , Code0Labels[1] );
- Data0Labels[0] = GetCatalogStr( Catalog , MSG_WIN_COMPILER_DSMALL , Data0Labels[0] );
- Data0Labels[1] = GetCatalogStr( Catalog , MSG_WIN_COMPILER_DLARGE , Data0Labels[1] );
- Calls0Labels[0] = GetCatalogStr( Catalog , MSG_WIN_COMPILER_REGISTER , Calls0Labels[0] );
- Calls0Labels[1] = GetCatalogStr( Catalog , MSG_WIN_COMPILER_TRSTACK , Calls0Labels[1] );
- HunkCode0Labels[0] = GetCatalogStr( Catalog , MSG_WIN_COMPILER_ONLYCTE , HunkCode0Labels[0] );
- HunkCode0Labels[1] = GetCatalogStr( Catalog , MSG_WIN_COMPILER_BOTHCS , HunkCode0Labels[1] );
- HunkCode0Labels[2] = GetCatalogStr( Catalog , MSG_WIN_COMPILER_ALLCTE , HunkCode0Labels[2] );
- Profile0Labels[0] = GetCatalogStr( Catalog , MSG_WIN_COMPILER_PROFILE_DISABLE , Profile0Labels[0] );
- Profile0Labels[1] = GetCatalogStr( Catalog , MSG_WIN_COMPILER_PROFILE_CODE , Profile0Labels[1] );
- Profile0Labels[2] = GetCatalogStr( Catalog , MSG_WIN_COMPILER_PROFILE_ALL , Profile0Labels[2] );
-
- while( n <= MSG_WIN_COMPILER_DIVERS_DLEVEL )
- {
- CompilerNGad[ n - MSG_WIN_COMPILER_GENERATION - 14 ].ng_GadgetText = GetCatalogStr( Catalog , n , CompilerNGad[ n - MSG_WIN_COMPILER_GENERATION - 14 ].ng_GadgetText );
- n++;
- }
- }
-
- void GetDirWnd( void )
- {
- DirSetNGad[0].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_DIR_SOURCE , DirSetNGad[0].ng_GadgetText );
- DirSetNGad[1].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_DIR_DEST , DirSetNGad[1].ng_GadgetText );
- DirSetNGad[2].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_DIR_INCLUDE , DirSetNGad[2].ng_GadgetText );
- DirSetNGad[3].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_DIR_LIB , DirSetNGad[3].ng_GadgetText );
- DirSetNGad[4].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_DIR_OBJ , DirSetNGad[4].ng_GadgetText );
- DirSetNGad[12].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_DIR_AUTO , DirSetNGad[12].ng_GadgetText );
- }
-
- void GetLinkerWnd( void )
- {
- int n = MSG_WIN_LINKER_CHIP;
-
- while ( n <= MSG_WIN_LINKER_UNIX )
- {
- LinkerNGad[ n - MSG_WIN_LINKER_CHIP + 2 ].ng_GadgetText = GetCatalogStr( Catalog , n , LinkerNGad[ n - MSG_WIN_LINKER_CHIP + 2 ].ng_GadgetText );
- n++;
- }
- }
-
- void GetGenOptWnd( void )
- {
- Type1Labels[0] = GetCatalogStr( Catalog , MSG_WIN_GENERAL_EXECUTABLE , Type1Labels[0] );
- Type1Labels[1] = GetCatalogStr( Catalog , MSG_WIN_GENERAL_LIBRARY , Type1Labels[1] );
- Type1Labels[2] = GetCatalogStr( Catalog , MSG_WIN_GENERAL_ROMABLE , Type1Labels[2] );
- GenOptNGad[0].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_GENERAL_FOTYPE , GenOptNGad[0].ng_GadgetText );
- GenOptNGad[1].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_GENERAL_OSVER , GenOptNGad[1].ng_GadgetText );
- GenOptNGad[2].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_GENERAL_OSREV , GenOptNGad[2].ng_GadgetText );
- }
-
- void GetPaletteWnd( void )
- {
- PalettePrefsNGad[0].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_PALETTE_PEN , PalettePrefsNGad[0].ng_GadgetText );
- PalettePrefsNGad[2].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_PALETTE_COLORS , PalettePrefsNGad[2].ng_GadgetText );
- PalettePrefsNGad[3].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_PALETTE_RED , PalettePrefsNGad[3].ng_GadgetText );
- PalettePrefsNGad[4].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_PALETTE_GREEN , PalettePrefsNGad[4].ng_GadgetText );
- PalettePrefsNGad[5].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_PALETTE_BLUE , PalettePrefsNGad[5].ng_GadgetText );
- Pens1Nodes[0].ln_Name = GetCatalogStr( Catalog , MSG_WIN_PALETTE_BLOCK , Pens1Nodes[0].ln_Name );
- Pens1Nodes[1].ln_Name = GetCatalogStr( Catalog , MSG_WIN_PALETTE_DETAIL , Pens1Nodes[1].ln_Name );
- Pens1Nodes[2].ln_Name = GetCatalogStr( Catalog , MSG_WIN_PALETTE_TEXT , Pens1Nodes[2].ln_Name );
- Pens1Nodes[3].ln_Name = GetCatalogStr( Catalog , MSG_WIN_PALETTE_BRIGHT , Pens1Nodes[3].ln_Name );
- Pens1Nodes[4].ln_Name = GetCatalogStr( Catalog , MSG_WIN_PALETTE_DARK , Pens1Nodes[4].ln_Name );
- Pens1Nodes[5].ln_Name = GetCatalogStr( Catalog , MSG_WIN_PALETTE_SFILL , Pens1Nodes[5].ln_Name );
- Pens1Nodes[6].ln_Name = GetCatalogStr( Catalog , MSG_WIN_PALETTE_TFILL , Pens1Nodes[6].ln_Name );
- Pens1Nodes[7].ln_Name = GetCatalogStr( Catalog , MSG_WIN_PALETTE_BACK , Pens1Nodes[7].ln_Name );
- Pens1Nodes[8].ln_Name = GetCatalogStr( Catalog , MSG_WIN_PALETTE_HIGH , Pens1Nodes[8].ln_Name );
- Pens1Nodes[9].ln_Name = GetCatalogStr( Catalog , MSG_WIN_PALETTE_TXTMENU , Pens1Nodes[9].ln_Name );
- Pens1Nodes[10].ln_Name = GetCatalogStr( Catalog , MSG_WIN_PALETTE_BACKMENU , Pens1Nodes[10].ln_Name );
- Pens1Nodes[11].ln_Name = GetCatalogStr( Catalog , MSG_WIN_PALETTE_TRIM , Pens1Nodes[11].ln_Name );
- }
-
- void GetScreenWnd( void )
- {
- ScreenPrefsNGad[0].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_SCREEN_DISPID , ScreenPrefsNGad[0].ng_GadgetText );
- ScreenPrefsNGad[3].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_SCREEN_RESTORE , ScreenPrefsNGad[3].ng_GadgetText );
- ScreenPrefsNGad[4].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_SCREEN_PALETTE , ScreenPrefsNGad[4].ng_GadgetText );
- ScreenPrefsNGad[6].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_SCREEN_TYPE , ScreenPrefsNGad[6].ng_GadgetText );
- ScreenPrefsNGad[8].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_SCREEN_WIDTH , ScreenPrefsNGad[8].ng_GadgetText );
- ScreenPrefsNGad[10].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_SCREEN_HEIGHT , ScreenPrefsNGad[10].ng_GadgetText );
- ScreenPrefsNGad[11].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_SCREEN_OVERSCAN , ScreenPrefsNGad[11].ng_GadgetText );
- ScreenPrefsNGad[12].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_SCREEN_DEFAULT , ScreenPrefsNGad[12].ng_GadgetText );
- ScreenPrefsNGad[13].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_SCREEN_AUTOSCROLL , ScreenPrefsNGad[13].ng_GadgetText );
- ScreenPrefsNGad[14].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_SCREEN_FONT , ScreenPrefsNGad[14].ng_GadgetText );
- ScreenPrefsNGad[15].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_SCREEN_SYSFONT , ScreenPrefsNGad[15].ng_GadgetText );
- Type0Labels[0] = GetCatalogStr( Catalog , MSG_WIN_SCREEN_PUBLIC , Type0Labels[0] );
- Type0Labels[1] = GetCatalogStr( Catalog , MSG_WIN_SCREEN_WB , Type0Labels[1] );
- }
-
- void GetMessages( void )
- {
- int n = MSG_MESSAGE_CONTINUE;
- char **s=StrMessages;
-
- while ( n < MSG_MENU_PROJECT )
- {
- *s = GetCatalogStr( Catalog , n , *s );
- n++;
- s++;
- }
- }
-
- void GetIncludeList(void )
- {
- CListeNGad[0].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_INCLUDE_TITLE , CListeNGad[0].ng_GadgetText );
- CListeNGad[1].ng_GadgetText = GetCatalogStr( Catalog , MSG_WIN_INCLUDE_EDIT , CListeNGad[1].ng_GadgetText );
- CListeNGad[2].ng_GadgetText = GetCatalogStr( Catalog , MSG_MESSAGE_ABORT , "_Cancel" );
- }
-
- void GetLocale(void)
- {
- if (LocaleBase=OpenLibrary("locale.library",38))
- {
- Catalog=OpenCatalog(NULL,"project_handler.catalog",
- OC_BuiltInLanguage, "english",
- OC_Version, 0,
- TAG_DONE);
- GetMenu( );
- GetUseCancel( );
- GetTitles( );
- GetCompilerWnd( );
- GetLinkerWnd( );
- GetGenOptWnd( );
- GetDirWnd( );
- GetScreenWnd( );
- GetPaletteWnd( );
- GetMessages( );
- GetIncludeList( );
- }
- }
-
- void FreeLocale(void)
- {
- if (LocaleBase) {
- if (Catalog) CloseCatalog(Catalog);
- CloseLibrary(LocaleBase);
- }
- }
-
-
- /****************************************************************************
- *** ***
- *** Programme principale comme l'on peut le constater ***
- *** ***
- ****************************************************************************/
-
- struct ExecBase *ExecBase;
-
- int main( int argc , char **argv ) {
- ExecBase = *((APTR *)4);
- ROMVersion = ExecBase->LibNode.lib_Version;
- if ( ROMVersion >= 38 )
- GetLocale( );
- else
- MakeUseCancel( );
- if ( InitVar( ) ) {
- if ( !(SetupScreen( ) ) ) {
- if ( !OpenProjectWindow( ) ) {
- AddWinC( ProjectWnd , HandleProjectIDCMP );
- WinControl( );
- }
- CloseDownScreen( );
- }
- FreeVar( );
- }
- if ( ROMVersion >= 38 )
- {
- FreeLocale( );
- }
- return( 0 );
- }
-
- int wbmain( struct WBStartup *WB ) {
- main( 0 , (char **)WB );
- }
-
-